""" user模型验证/DTO """

from pydantic import BaseModel


class UserBase(BaseModel):
    username: str


class UserCreate(UserBase):
    """
    请求模型验证：
    username:
    password:
    """
    # username: str
    password: str


class User(UserBase):
    """
    响应模型：
    id:
    username:
    并且设置orm_mode与之兼容
    """
    id: int

    class Config:
        orm_mode = True


class LoginModel(BaseModel):
    """ 用户登录模型 """
    username: str = None
    password: str = None


class TokenModel(BaseModel):
    """ 登录成功返回token模型 """
    id: int
    username: str
    token: str
